package com.ruoyi.terminal.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.terminal.domain.DcTermpara;
import com.ruoyi.terminal.service.IDcTermparaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 参数管理Controller
 * 
 * @author ruoyi
 * @date 2020-12-28
 */
@RestController
@RequestMapping("/para")
public class DcTermparaController extends BaseController
{
    @Autowired
    private IDcTermparaService dcTermparaService;

    /**
     * 查询参数管理列表
     */
    @PreAuthorize(hasPermi = "terminal:para:list")
    @GetMapping("/list")
    public TableDataInfo list(DcTermpara dcTermpara)
    {
        startPage();
        List<DcTermpara> list = dcTermparaService.selectDcTermparaList(dcTermpara);
        return getDataTable(list);
    }

    /**
     * 获取参数管理详细信息
     */
    @PreAuthorize(hasPermi = "terminal:para:query")
    @GetMapping(value = "/{termImei}")
    public AjaxResult getInfo(@PathVariable("termImei") String termImei)
    {
        return AjaxResult.success(dcTermparaService.selectDcTermparaById(termImei));
    }

    /**
     * 修改参数管理
     */
    @PreAuthorize(hasPermi = "terminal:para:edit")
    @Log(title = "参数管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DcTermpara dcTermpara)
    {
        return toAjax(dcTermparaService.updateDcTermpara(dcTermpara));
    }

}
